package com.supermap.business.test;

import java.math.BigDecimal;

/**
 * @author aqua
 * @desc
 * @date 2019年05月30 16:31
 * @email 1301584033@qq.com
 */
public class Challenger {
    // 挑战者姓名
    private String name;
    // 命中率
    private double hit_rate;
    // 生?死
    private boolean alive;
    // 开枪的次数
    private int num;

    public Challenger(String name, double hit_rate) {
        super();
        this.name = name;
        this.hit_rate = hit_rate;
        this.alive = true;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHit_rate() {
        return hit_rate;
    }

    public void setHit_rate(double hit_rate) {
        BigDecimal b = new BigDecimal(hit_rate);
        hit_rate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
        this.hit_rate = hit_rate;
    }

    public boolean isAlive() {
        return alive;
    }

    public void setAlive(boolean alive) {
        this.alive = alive;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "[姓名=" + name + ", 命中率=" + hit_rate + ", 开枪的次数=" + num + "]";
    }


}
